package cn.com.hori.cms.dao;

import cn.com.hori.cms.entities.Accessories;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.awt.print.Pageable;
import java.util.List;

/**
 * @author 刘艺
 * @date 2018/3/12 10:40
 */
@Repository
public interface AccessoriesRepository extends JpaRepository<Accessories, Long> {

    /**
     * 根据 contentID 来查询属于此文章的附件
     * @param contentId contentID
     * @param pageable 分页参数
     * @return 返回附件列表
     */
    @Query("select accessories from Accessories accessories where accessories.belongToContent=?1")
    List<Accessories> findAllBybelongToContent(String contentId, Pageable pageable);



}
